package com.twang.stock.controller.old;

import com.google.common.collect.Lists;
import com.twang.stock.Entity.ResponseEntity;
import com.twang.stock.controller.common.BaseControoler;
import com.twang.stock.entity.StockWarningEvent;
import com.twang.stock.service.jinyan.EventWarnService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping(value = "/event")
@Slf4j
public class EventWarnController extends BaseControoler {

    private EventWarnService eventWarnService;

    public ResponseEntity queryEvent(String date, String type) throws Exception {
        List<StockWarningEvent> eventList = Lists.newArrayList();
        try {
            eventList = eventWarnService.queryEvent(date, type);
        } catch (Exception e) {
            log.error("error ={}", e);
            throw new Exception("系统异常");
        }
        return responseSuccess(eventList);
    }
}
